package com.cosina.game.robodefence.util;

public class UpCount {
	public int max ;
	public UpCount(int max){
		if(max < 0){
			throw new IllegalArgumentException("cycle must more than zero");
		}
		this.max = max;
	}
	
	public void setMax(int newMax){
		if(newMax < 0){
			throw new IllegalArgumentException("cycle must more than zero");
		}
		this.max = newMax;
	}
	
	public int value = 0; 
	
	
	public boolean upToAlram(){
		return upToAlram(1);
	}
	
	public boolean upToAlram(int addValue){
		value += addValue;
		if(value >= max){
			value = value - max;
			return true;
		}
		return false;
	}
	
}
